<p-table [columns]="model.cols" [value]="model.data" [loading]="model?.loading"
         [paginator]="pager.enabled" [rows]="pager?.pageSize" [pageLinks]="pager?.pageLinks"
         [rowsPerPageOptions]="pager?.rowsPerPageOptions" [totalRecords]="pager?.totalCount"
         [lazy]="true" (onLazyLoad)="loadLazy($event)">
  <ng-template pTemplate="caption">
    <div class="text-left">
      <button pButton *ngFor="let btn of buttons?.listTopButtons" [title]="btn.buttonTitle" (click)="btnClick(btn)"  [icon]="btn.icon" [class]="btn.buttonClass"></button>
      <!--<div class="float-right">-->
        <!--<button pButton type="button" (click)="tableRefresh()" icon="fa-refresh" ></button>-->
        <!--&lt;!&ndash;<button pButton type="button" (click)="listHelp.toggle($event)" icon="fa-question" class="ui-button-secondary"></button>&ndash;&gt;-->
      <!--</div>-->
    </div>
  </ng-template>
  <ng-template pTemplate="header" let-columns>
    <tr>
      <th style="width:3em;"></th>
      <th *ngFor="let col of columns"  [ngStyle]="col?.style">
        {{col.header}}
      </th>
      <th *ngIf="buttons?.hasRowButtons">操作</th>
    </tr>
  </ng-template>
  <ng-template pTemplate="body" let-rowData let-columns="columns" let-index="rowIndex">
    <tr [pReorderableRow]="index">
      <td class="text-center">{{index+1}}</td>
      <td *ngFor="let col of columns">
        <span *ngIf="!col?.isYesNo">{{rowData[col.field]}}</span>
        <span *ngIf="col?.isYesNo">{{rowData[col.field] ? '否':'是'}}</span>
      </td>
      <td>
        <button pButton *ngFor="let btn of buttons?.listRowButtons" (click)="btnClick(btn,rowData)"
                [title]="btn.functionName" [icon]="btn.icon" class="row-btn {{btn.buttonClass}}"></button>
      </td>
    </tr>
  </ng-template>
</p-table>
